package com.yzf.wisecoder.controller;

import com.yzf.wisecoder.wisecodercommon.response.Response;
import com.yzf.wisecoder.wisecodercommon.vo.response.ViewConfigResp;
import com.yzf.wisecoder.wisecoderservice.service.ViewConfigPublishService;
import com.yzf.wisecoder.wisecoderstorage.mysql.entity.ViewConfigEntity;
import com.yzf.wisecoder.wisecoderstorage.mysql.entity.ViewConfigPublishEntity;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author jianghuiyong
 * @Description 大屏发布控制
 * @date 2020/5/20 13:55
 */
@RestController
@RequestMapping("sys/viewconfigpublish")
@AllArgsConstructor
@Api(value = "大屏发布控制", tags = "大屏发布控制")
public class ViewConfigPublishController {

    private final ViewConfigPublishService viewConfigPublishService;

    /**
     * 查询大屏配置信息
     *
     * @param viewId
     * @return
     */
    @GetMapping("/info")
    @ApiOperation(value = "查询大屏配置信息")
    public Response<ViewConfigResp> info(@RequestParam Long viewId) {
        ViewConfigPublishEntity viewConfig = viewConfigPublishService.getById(viewId);
        ViewConfigResp viewConfigResp = new ViewConfigResp();
        BeanUtils.copyProperties(viewConfig, viewConfigResp);
        return Response.buildSuccessResponseWithData(viewConfigResp);
    }
}
